//
//  QBServiceConvert.m
//  QBPatient
//
//  Created by wenzi on 16/8/25.
//  Copyright © 2016年 QB. All rights reserved.
//

#import "QBServiceConvert.h"

////国内IP(测试)
#define LandIpUrl             @"http://test.ivf-bb.com/qibei_api/public/index.php?s=/v3/"
//国外IP(测试)
#define AbroadIpUrl           @"http://ceshi.ivf-bb.com/qibei_api/public/index.php?s=/v3/"

//国内IP(上线)
//#define LandIpUrl             @"http://www.ivf-bb.com/qibei_api/public/index.php?s=/v3/"
////国外IP(上线)
//#define AbroadIpUrl           @"http://en.ivf-bb.com/qibei_api/public/index.php?s=/v3/"


@implementation QBServiceConvert

+(NSString *)GetMainIPURL{
    
    NSString *mainStr = [[NSString alloc] init];
    
    BOOL isChina = [self isInChina];
    
    if (isChina == YES) {
        
        mainStr = LandIpUrl;
        
    } else if (isChina == NO){
        
        mainStr = AbroadIpUrl;
    }
    
    return mainStr;
    
}

+ (NSString *)GetConfigURL{
    
    NSString *configStr = [[NSString alloc] init];
    
    NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
    NSString *currentAppVersion = [infoDict objectForKey:@"CFBundleShortVersionString"];
   
    configStr = [NSString stringWithFormat:@"/client_version/%@/mac_code/1.0.1.1/client_type/ios/client_token/2a8242f0858bbbde9c5dcbd0a0008e5a", currentAppVersion];
    
    return configStr;
}

+ (BOOL)isInChina{
    
    BOOL result = NO;
    
    if([[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Chongqing"].location == 0 ||
       [[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Harbin"].location == 0 ||
       [[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Hong_Kong"].location == 0 ||
       [[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Macau"].location == 0 ||
       [[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Shanghai"].location == 0 ||
       [[[NSTimeZone localTimeZone] name] rangeOfString:@"Asia/Taipei"].location == 0){
        
        result = YES;
    }
    
    return result;
}





@end

